const express = require('express');
const cookieparser = require('cookie-parser');
const app = express();
app.use(cookieparser())
app.get('/set-cookie',(req,res)=>{
    //res.cookie("name","zhangsan");
    res.cookie("name","zhangsan",{maxAge:60*1000});
    res.cookie("theme","blue")
    res.send('home');
})
app.get('/remove-cookie',(req,res)=>{
    res.clearCookie("name")
    res.send('删除成功');
})
//获取cookie
app.get('/get-cookie',(req,res)=>{
    console.log(req.cookies);
    res.send(`欢迎您${req.cookies.name}`)
})
app.listen(3000);